package com.cq.hd.common.enums.biz;

import lombok.Getter;

/**
 * 会员类型：状态(1-商场版，2-商户版)
 */
public enum MemberTypeEnum {

    BUSINESS(1, "商场版"),
    MERCHANT(2, "商户版"),
    ;

    @Getter
    private final Integer value;

    @Getter
    private final String name;

    MemberTypeEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static MemberTypeEnum typeOf(Integer value) {
        MemberTypeEnum[] values = MemberTypeEnum.values();
        for (MemberTypeEnum v : values) {
            if (v.value.equals(value)) {
                return v;
            }
        }
        return null;
    }

    public static MemberTypeEnum typeOf(String name) {
        MemberTypeEnum[] values = MemberTypeEnum.values();
        for (MemberTypeEnum v : values) {
            if (v.name.equals(name)) {
                return v;
            }
        }
        return null;
    }

}
